#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize, int* obstacleGridColSize);

int main()
{
	return 0;
}

int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize, int* obstacleGridColSize)
{
	int* dp = calloc(*obstacleGridColSize, sizeof(int));
	for (int col = 0, len = *obstacleGridColSize; col < len; col++) {
		if (obstacleGrid[0][col] == 1) break;
		dp[col] = 1;
	}

	for (int row = 1; row < obstacleGridSize; row++) {
		dp[0] = obstacleGrid[row][0]? 0: dp[0];
		for (int col = 1, len = *obstacleGridColSize; col < len; col++)
			dp[col] = obstacleGrid[row][col] ? 0 : dp[col - 1] + dp[col];
	}

	return dp[*obstacleGridColSize - 1];
}
